home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
prog
/
word.arj
/
INTRO.DOC
< prev
next >
Wrap
Text File
|
1993-01-28
|
8KB
|
160 lines
WordUp Graphics Toolkit V3.5
for Turbo C++ v.1.0
Copyright 1993 Chris Egerter
The WordUp Graphics Toolkit is a large collection of functions for use
in Turbo C++ programs which control many aspects of graphics programming.
This library was created since there weren't any other libraries which
suited our needs. WGT provides enough graphics capabilities to satisfy
the professional programmer, yet is easy enough for beginners.
Because the library is quite large and contains many functions, we don't
expect you to learn everything at once. If you get stuck, look through
the example files for help, and don't give up! Anything is possible once
you know how to use the WGT system.
WGT includes most of the usual functions found in the common graphics
programming library such as lines, circles, bars, etc. However, many
functions are much more complex, such as drop down menus, multidirectional
scrolling, custom fonts, sprite movement and animation control, palette
manipulation, special FX, a graphical file selector, and much more...
Suggested Order of Learning Topics
----------------------------------
Several example files (number WGTxx.c) should be compiled and studied
in numerical order. This will help you understand many of the commands
available.
Please try out each example program, and most importantly, EXPERIMENT!
The best way to learn is to try things for yourself. If you just load in
the example files and run them, you will not gain anything. If you
happen to run into a problem, check the WGT documentation on the functions
you are using, read the troubleshooting document, and if all else fails,
mail WordUp Software Productions at the address on the order form.
All of the libraries have been tested well, and the problem is most likely
the way your compiler or linker is set up. However there may be a few bugs,
and we'd like to hear about them.
Graphics Programming: An Introduction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When programming in graphics mode, the screen is made up of
many small dots. The WGT library uses a mode which has 320 dots across
the screen, and 200 down. Each dot can change colours. There are 256
different colours possible for each dot. When placed side by side
in a rectanglar lattice pattern, the dots form more complex shapes.
Each of these dots are called pixels. The 256 colours you can select
from is called the palette.
Since the screen 320 by 200 pixels, there is a total of 64000
(320 times 200) pixels on the screen at all times. Since there are 256
possible colours, each pixel requires 1 byte of information
(which ranges 0-255). Therefore a full screen to be saved requires 64000
bytes of memory.
The palette is made of 256 containers ranging in number 0-255.
Each of the 256 colours is made up of red, green, and blue values.
For short, RGB means red,green, and blue. Imagine mixing colours of
paint together using only the primary colours. From the RGB colours,
you can make many other colours and shades. Each RGB value ranges 0-63.
This is the standard for VGA cards. With 64 possible combinations for
each of the RGB values, you have a possible 262144 (64*64*64)
colour combinations!
So now you know that the screen is made of pixels which can be
one of 256 colours. Obviously setting each one of these pixels to different
colours to make a picture would be an enormous task if you had to set every
pixel one at a time. The WGT library helps you out by giving you control
of many commands which manipulate the pixels for you. For example, to draw
a line, just call the line command, and tell it where the endpoints are.
WGT will do all the calculations for you, and draw the line. When you
call the line command, you need to tell where the line is on the screen.
This is done by giving some coordinates. Each coordinate is made of two
values: X and Y. X means how many pixels across the screen and Y is how
many pixels down the screen, with 0 being the top left corner.
Here is a simple diagram with a few coordinates to help you out:
This is your monitor!
------------------------------------------
|(0,0) (319,0)|
| | A line drawn a line from (100,40)
| | | to (110,150), it would look like
| | | this:
| .(50,50) | | |
| | <-----------------------
| | |
| | |
| | |
| |
|(0,199) (319,199)|
------------------------------------------
The WGT library gets much more complex depending on which functions you
use. It can control the palette, by fading in or out, or rotating it
(color cycling). It also handles areas of the screen called blocks, which
hold many pixels together and rectangular arrays. Blocks can be flipped,
stretched, warped, resized, pasted on the screen, and many other operations.
This should be enough to get you started. Have fun and explore the
possibilities of the WordUp Graphics Toolkit!
How to link the example programs:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WGT v3.5 contains many example programs which you can examine or
change as you like. To link an example program with the libraries
needed, run the Turbo IDE. Change to the directory where all of
the example C programs are. Next, open a project file. There should
be some listed in the dialog. Click on the appropriate project file,
and run the program. This is necessary because the Turbo C++ linker
doesn't know what the WGT commands are, until you link in the WGT
libraries. Take a look at the project window, as it will list the
libraries and files you are currently linking together.
The examples named WGTnn.c should be used with the wgtdemo project
file.
Not all examples will work with the current setup in wgtdemo.prj.
If the linker reports an undefined symbol, pick out which library is needed
out of the list below, and add it to the list in the project window.
WGT35.LIB.......Main library (always link this)
WSPR.LIB........Static background sprite library
WGT4SCR.LIB.....Multidirectional scrolling library
WGTMENU.LIB.....Custom drop down menu library
WGTFLI.LIB......FLI library
WGTJOY.LIB......Joystick routine library
WGTSB.LIB.......SoundBlaster routine library
FILESEL.LIB.....File selector routine
Many of the example programs are not complete. They aren't meant as
games to play around with, but show how to use WGT. You may have more
fun completing yourself, as you get to know the WGT system.
Sprites: Why and When to use them:
----------------------------------
The WordUp Graphics Toolkit contains a special sprite library.
Sprites are basically animated moving objects on the screen. Sprites
can be drawn with the WGT Sprite Creator, and loaded into your program
with a few commands. Each sprite file created can hold up to 1000 sprites
along with one palette. A block is an area of screen memory which can
be stored and changed using different commands. When a sprite file is
loaded, it simply places the sprites into an array of blocks.
The array is always called 'sprites[1001]' and single sprites can be
accessed by the array.
WGT includes a library just for sprites which controls all animation and
movement. This requires very little knowledge of the sprite array, however
you can use the array yourself if you want to.
The library for sprites requires the background to remain relatively the
same. Scrolling backgrounds involve the usage of a completely different
system of moving images. Please read scroll.doc for more information regarding
scrolling backgrounds. You must plan ahead, and use the appropriate system
for your task.